package leetcode.code0728;

import java.util.ArrayList;
import java.util.List;

import leetcode.IDebug;

public class Solution implements IDebug {

	public List<Integer> selfDividingNumbers(int left, int right) {
		List<Integer> ans = new ArrayList<>();
		for (int i = left; i <= right; i++) {
			if (self(i)) {
				ans.add(i);
			}
		}
		return ans;
	}

	private boolean self(int i) {
		int num = i;
		while (num > 0) {
			int last = num % 10;
			if (last == 0 || i % last != 0)
				return false;
			num /= 10;
		}
		return true;
	}

	@Override
	public void debug4() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
